<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // map转数组
        let map1 = new Map()
            .set(true, 'AAA')
            .set(false, 'aaa');
        map1.set({age: 18}, ['eat', 'sleep', 'coding']);
        console.log(map1);
        // map转数组
        let arr1 = [...map1];
        console.log(arr1);


        // 数组转map
        let arr2 = [1,2,3];
        // 数组的总长度是map的size；每一项数组中，第一个值作为key，第二个值作为value
        let map2 = new Map([['a', 'a对应的value'], [1,2], ['我是key', '我是value']]);
        console.log(map2);
    </script>
</body>
</html>